<template>
  <div>
    <div class="header-wrap">
      <!-- 导航栏 -->
      <hi-navbar fixed transparent="show" :backgroundColor="[237, 240, 243]">
      </hi-navbar>
    </div>
    <div class="u-m-t-32 u-p-l-32 u-p-r-32">
      <div
        class="u-main-color u-flex u-row-center u-m-b-32 u-font-xl font-bold"
      >
        {{ newData.title }}
      </div>
      <div class="u-m-b-32">
        <text class="u-m-r-12">{{ newData.created_at | parseTime() }}</text>
        <u-tag
          :text="newData.tag"
          :type="newData.type"
          size="mini"
          shape="circle"
        ></u-tag>
      </div>
      <v-parser :html="newData.content"></v-parser>
    </div>
  </div>
</template>

<script>
import VParser from "@/components/jyf-parser/jyf-parser"

let selectId = null

export default {
  components: {
    VParser,
  },
  data() {
    return {
      newData: {
        title: "",
        content: "",
      },
    }
  },
  onLoad(e) {
    selectId = e.id
    this.getDetail(selectId)
  },
  methods: {
    getDetail(id) {
      let News = new wx.BaaS.TableObject("news")

      News.get(id).then((res) => {
        this.newData = res.data
      })
    },
  },
}
</script>

<style></style>
